import { Component } from "react";

class Alert extends Component {
    state = {
        counts: 1,
    };
    increment = () => {
        this.setState({
            counts: this.state.counts + 1,
        });
    };
    render() {
        return (
            <>
                <div className='alert alert-danger'>
                    当前数值为:{this.state.counts}
                </div>
                <button className='btn btn-danger' onClick={this.increment}>
                    增加
                </button>
            </>
        );
    }
}

export default Alert;
